package com.ocom.common.enums.emqx;

/**
 * 洗衣机物联网异常状态枚举
 */
public enum ErrStatusEnum {


    OtherFaults(1,"其它故障"),
    InletErr(2,"进水故障"),
    DrainageErr(3,"排水故障"),
    OpenIngErr(4,"门盖打开"),
    SensorErr(5,"水位传感器故障"),
    CommErr(6,"通讯故障"),
    ImbalancErr(7,"脱水不平衡"),
    OverflowErr(8,"溢水"),


    FREE(0,"空闲");

    private final Integer key;
    private final String msg;

    ErrStatusEnum(Integer key, String msg) {
        this.key = key;
        this.msg = msg;
    }

    /**
     * 根据key获取value
     *
     * @param key : 键值key
     * @return String
     */
    public static String getValueByKey(Integer key) {
        ErrStatusEnum[] enums = ErrStatusEnum.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getKey().equals(key)) {
                return enums[i].getMsg();
            }
        }
        return "";
    }

    public Integer getKey() {
        return key;
    }

    public String getMsg() {
        return msg;
    }
}
